package com.ssy.lingxi.settle.accounts.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 平台优惠价结算明细
 * @author 彭冬冬
 * @version 2.0.0
 * @date 2022/1/17 15:56
 */
@Entity
@Table(schema = "public",
        name = "sa_platform_coupon_settlement_detail",
        indexes = {@Index(name = "sa_platform_coupon_settlement_settlement_id_idx", columnList = "settlement_id"),
                @Index(name = "sa_platform_coupon_settlement_detail_order_time_idx", columnList = "orderTime")
        }
)
public class PlatformCouponSettlementDetailDO implements Serializable {
    private static final long serialVersionUID = 5822333226169000043L;


    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sa_platform_coupon_settlement_detail_seq")
    @SequenceGenerator(sequenceName = "sa_platform_coupon_settlement_detail_seq", name = "sa_platform_coupon_settlement_detail_seq", allocationSize = 1)
    private Long id;

    /**
     * 平台优惠券结算
     */
    @JsonBackReference
    @ManyToOne(optional = false,  fetch = FetchType.LAZY)
    @JoinColumn(name = "settlement_id")
    private PlatformCouponSettlementDO settlement;

    /**
     * 会员id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberId;

    /**
     * 角色id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long roleId;

    /**
     * 单据号
     */
    @Column(columnDefinition = "varchar(50)")
    private String orderNo;

    /**
     * 单据摘要
     */
    @Column(columnDefinition = "varchar(100)")
    private String orderAbstract;

    /**
     * 单据类型
     * 定义: SettlementOrderTypeEnum
     */
    @Column(columnDefinition = "int")
    private Integer settlementOrderType;


    /**
     * 退货申请单号
     */
    @Column(columnDefinition = "varchar(50)")
    private String returnCode;

    /**
     * 退货明细id
     */
    @Column
    private Long returnDetailId;

    /**
     * 来源订单号 - 退货订单传
     */
    @Column(columnDefinition = "varchar(50)")
    private String sourceOrderNo;

    /**
     * 单据时间
     */
    @Column(columnDefinition = "int8")
    private Long orderTime;

    /**
     * 订单类型
     * 定义: ReceiptInvoiceOrderTypeEnum
     */
    @Column(columnDefinition = "int")
    private Integer orderType;

    /**
     * 单据总额
     */
    @Column(columnDefinition = "decimal")
    private Double orderAmount;

    /**
     * 优惠券id
     */
    @Column(columnDefinition = "int8")
    private Long couponId;

    /**
     * 优惠券编码
     */
    @Column(columnDefinition = "varchar(50)")
    private String couponNo;

    /**
     * 优惠券金额
     */
    @Column(columnDefinition = "decimal")
    private Double couponAmount;

    /**
     * 支付时间
     */
    @Column(columnDefinition = "int8")
    private Long payTime;


    /**
     * 结算金额
     */
    @Column(columnDefinition = "decimal")
    private Double settlementAmount;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public PlatformCouponSettlementDO getSettlement() {
        return settlement;
    }

    public void setSettlement(PlatformCouponSettlementDO settlement) {
        this.settlement = settlement;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderAbstract() {
        return orderAbstract;
    }

    public void setOrderAbstract(String orderAbstract) {
        this.orderAbstract = orderAbstract;
    }

    public Integer getSettlementOrderType() {
        return settlementOrderType;
    }

    public void setSettlementOrderType(Integer settlementOrderType) {
        this.settlementOrderType = settlementOrderType;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(String returnCode) {
        this.returnCode = returnCode;
    }

    public Long getReturnDetailId() {
        return returnDetailId;
    }

    public void setReturnDetailId(Long returnDetailId) {
        this.returnDetailId = returnDetailId;
    }

    public String getSourceOrderNo() {
        return sourceOrderNo;
    }

    public void setSourceOrderNo(String sourceOrderNo) {
        this.sourceOrderNo = sourceOrderNo;
    }

    public Long getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Long orderTime) {
        this.orderTime = orderTime;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Double getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(Double orderAmount) {
        this.orderAmount = orderAmount;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public String getCouponNo() {
        return couponNo;
    }

    public void setCouponNo(String couponNo) {
        this.couponNo = couponNo;
    }

    public Double getCouponAmount() {
        return couponAmount;
    }

    public void setCouponAmount(Double couponAmount) {
        this.couponAmount = couponAmount;
    }

    public Long getPayTime() {
        return payTime;
    }

    public void setPayTime(Long payTime) {
        this.payTime = payTime;
    }

    public Double getSettlementAmount() {
        return settlementAmount;
    }

    public void setSettlementAmount(Double settlementAmount) {
        this.settlementAmount = settlementAmount;
    }
}
